<?php 

class Ext_Validate_Adapter_Captcha extends Ext_Validate_Abstract
{
    protected $_captcha;

    public function __construct($captcha)
    {
        $this->_captcha = $captcha;
    }
    
    public function isValid()
    {
        $checkor = new Ext_Captcha_Check($this->_captcha);
        $checkResultor = $checkor->check();
        if(!$checkResultor->isValid()){
            $this->addTitleMessages('Captcha', $checkResultor->getMessages());
            return false;
        }

        return true;
    }
}
